/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.system.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.common.cache.DictCache;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.admin.entity.UserCert;
import org.springblade.modules.admin.entity.UserElevatorBrand;
import org.springblade.modules.admin.entity.UserElevatorSkill;
import org.springblade.modules.admin.vo.UserCertVO;

import java.util.Date;
import java.util.List;

/**
 * 实体类
 *
 * @author Chill
 */
@Data
@TableName("blade_user")
@EqualsAndHashCode(callSuper = true)
public class User extends TenantEntity {

	private static final long serialVersionUID = 1L;

	/**
	 * 用户编号
	 */
	private String code;
	/**
	 * 用户平台
	 */
	private Integer userType;
	/**
	 * 账号
	 */
	private String account;
	/**
	 * 密码
	 */
	private String password;
	/**
	 * 昵称
	 */
	private String name;
	/**
	 * 真名
	 */
	private String realName;
	/**
	 * 头像
	 */
	private String avatar;
	/**
	 * 邮箱
	 */
	private String email;
	/**
	 * 手机
	 */
	private String phone;
	/**
	 * 生日
	 */
	private Date birthday;
	/**
	 * 性别
	 */
	private Integer sex;
	/**
	 * 角色id
	 */
	private String roleId;
	/**
	 * 部门id
	 */
	private String deptId;
	/**
	 * 岗位id
	 */
	private String postId;
	/**
	 * 中文编码
	 */
	private String zhCode;
	/**
	 * 人员等级
	 */
	private Integer level;


	@ApiModelProperty("false表示可删true不可删除")
	private Boolean isMustNot;

	@TableField(exist = false)
	private String tenantName;

	@TableField(exist = false)
	private Integer companyCategory;

	@TableField(exist = false)
	private String location;

	/**
	 * 用户地址
	 */
	@TableField(value = "address", exist = false)
	private String address;

	/**
	 * 用户地址经度
	 */
	@TableField(value = "longitude", exist = false)
	private String longitude;

	/**
	 * 用户地址纬度
	 */
	@TableField(value = "latitude", exist = false)
	private String latitude;

	/**
	 * 交通工具
	 */
	@TableField(value = "vehicle", exist = false)
	private String vehicle;
	@TableField(exist = false)
	private String vehicleName;

	/**
	 * 所属公司
	 */
	@TableField(exist = false)
	private String subCom;

	/**
	 * 是否展示用户信息 1-展示 2-不展示
	 */
	@TableField(exist = false)
	private Integer showInfo;

	@TableField(exist = false)
	private List<UserCert> userCerts;

	@TableField(exist = false)
	private List<UserCertVO> userCertDetails;

	/**
	 * 用户保养工单工作项全选开关值 0-关 1-开
	 */
	@TableField(exist = false)
	private Integer checkContentAll;


	@TableField(exist = false)
	private String deptNames;

	@TableField(exist = false)
	private String roleName;

	@TableField(exist = false)
	private Boolean disabled = false;

	@TableField(exist = false)
	private String startTime;

	@TableField(exist = false)
	private String endTime;


	@TableField(exist = false)
	@ApiModelProperty("用户品牌关系")
	private List<Long> userElevatorBrandIds;

	@TableField(exist = false)
	@ApiModelProperty("用户技能关系")
	private List<Long> userElevatorSkillIds;

	@TableField(exist = false)
	@ApiModelProperty("用户技能名称")
	private String skillNames;

	public void setVehicle(String vehicle) {
		this.vehicle = vehicle;
		if (Func.isNotBlank(vehicle)) {
			this.vehicleName = DictCache.getValue("vehicle", vehicle);
		}
	}

	public void setSex(Integer sex) {
		this.sex = sex;
		if (Func.isNotEmpty(sex)) {

		}
	}
}
